<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport" />
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta content="telephone=no" name="format-detection" />
    <link rel="stylesheet" type="text/css" href="/static/plugs/layui-v2.5.6/css/layui.css" />
    <!--    <link rel="stylesheet" type="text/css" href="/static/plugs/layui-v2.5.6/css/modules/code.css" />-->
    <!--    <link rel="stylesheet" type="text/css" href="/static/plugs/layui-v2.5.6/css/modules/laydate/default/laydate.css?v=5.0.9" />-->
    <!--    <link rel="stylesheet" type="text/css" href="/static/plugs/font-awesome-4.7.0/css/font-awesome.min.css" />-->
    <!--    <link rel="stylesheet" type="text/css" href="/static/admin/css/public.css?v=1676709443" />-->
    <script src="/static/plugs/layui-v2.5.6/layui.js"></script>
    <title>我的评价</title>

</head>
<body>
<div class="top"  style="font-width: 600;font-size:20px;margin: 14px 0 12px 0;font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif;vertical-align: middle;color:#444743;text-align: center">
    <h5>追评</h5>
</div>
<div>
    <form id="app-form" class="layui-form layuimini-form">
        <input type="hidden" name="template_id" value="">
        <input type="hidden" name="qr_id" value="">
        <input type="hidden" name="users_id" value="">
        <input type="hidden" name="qr_user_id" value="">
        <div >
            <textarea name="content" rows="8" class="layui-textarea editor" 评价内容 placeholder="请输入评价内容"></textarea>
        </div>


        <div class="hr-line"></div>
        <br><br>
        <div class="layui-form-item text-center" style="text-align: center">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit lay-filter="sub">确认</button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
            <button type="submit" class="layui-btn  layui-btn-sm" onclick="jump()">往期评价</button>
        </div>

    </form>
</div>




</body>
</html>
<script src="/h5/js/bootstrap.js"></script>
<script type="text/javascript" src="/h5/js/jquery.min.js"></script>
<script type="text/javascript" src="/h5/js/stars.js"></script>
<script type="text/javascript" src="/h5/js/layer.js"></script>
<script>

    var template_id = GetQueryString('template_id');
    var qr_id = GetQueryString('qr_id');
    var users_id = GetQueryString('users_id');
    var qr_user_id = GetQueryString('qr_user_id');
    $("[name='template_id']").val(template_id);
    $("[name='qr_id']").val(qr_id);
    $("[name='users_id']").val(users_id);
    $("[name='qr_user_id']").val(qr_user_id);
    function GetQueryString(name)
    {
        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if(r!=null)return  unescape(r[2]); return null;
    }
    function jump()
    {
        window.open("myinfo.html?template_id="+template_id + "&qr_id="+qr_id + "&users_id=" +users_id + "&qr_user_id=" + qr_user_id);
    }
    //表单追加评价
    layui.use([ 'element', 'jquery', 'laydate', 'form'],function() {
        var $ = layui.jquery;
        var element = layui.element;
        var laydate = layui.laydate;
        var form = layui.form;
        //监听提交事件
        form.on('submit(sub)', function(data){
            // console.log(data);return false;
            var fields=$(data.form).serializeArray();// serialize
            var ret = true;
            var msg = '';
            $.each(fields, function(index, value) {
                // alert(index + ': ' + value.name);

                if(value.name == "content" && value.value == ''){
                    ret = false;
                    msg = '请进行文字评价';
                    return false;
                }
            });
            if(ret == false){
                layer.msg(msg);return false;
            }
            //使用ajax发送请求
            $.ajax({
                url:"/api/evaluation.zhuiping/addReview",
                type:"post",
                data:fields,
                dataType:"json",
                success:function(data){
                    // $("[name='content']").val('');
                    layer.msg(data.msg);
                    //window.location = './myinfo.html'
                    // 关闭窗口
                    var index = parent.layer.getFrameIndex(window.name); //获取当前窗口的name
                    parent.layer.close(index);//关闭窗口
                }
            });
            return false;  //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
    });
</script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script>
    function onBridgeReady() {
        WeixinJSBridge.call('hideOptionMenu');
    }

    if (typeof WeixinJSBridge == "undefined") {
        if (document.addEventListener) {
            document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
        } else if (document.attachEvent) {
            document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
            document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
        }
    } else {
        onBridgeReady();
    }
</script>